package day22;

import java.util.Scanner;

/**
 * @author tongchen
 * @create 2023-03-29 19:25
 */
public class Main {
    public static void main(String[] args) {
        //输入
        Scanner scanner=new Scanner(System.in);
        while(scanner.hasNextInt()){
            int num=scanner.nextInt();
            int[]arr=new int[num];
            int ability=scanner.nextInt();
            for(int i=0;i<num;++i){
                arr[i]=scanner.nextInt();
            }
            int i = askAbility(ability, arr);
            System.out.println(i);
        }


    }
    public static int askAbility(int ability,int []dficts){
            //测试
        for(int i=0;i<dficts.length;++i){
            if(ability>=dficts[i]){
                ability+=dficts[i];
            }else{
                ability+=gcd(ability, dficts[i]);
            }
        }
        return ability;
    }
    //辗转相除法求最大公倍数
    public static  int gcd(int a,int b){
        int c=a%b;
        while(c!=0){
            a=b;
            b=c;
            c=a%b;
        }
        return b;
    }
}
